#ifndef LIGHT_H
#define LIGHT_H

#include <math.h>
#include "GL/glew.h"
#include "GL/glfw.h"
#include <GL/glu.h>
#include <stdio.h>

#define LIGHTTYPE_POINT 0
#define LIGHTTYPE_SPOT  1

class Light
{
public:
	Light(float _pos[3], float _prop_ambient[4], float _prop_diffuse[4], float _prop_specular[4]);
	Light(float _pos[3], float _prop_direction[4], float _prop_cutoff, float _prop_exponent, float _prop_ambient[4], float _prop_diffuse[4], float _prop_specular[4], bool _cast_shadow, float _shadow_map_size);
	~Light();

	void enable();
	void push_props(GLenum _id); // push light properties to ogl
	void disable();
	void setPos();

	// shadows
	void shadowmap_begin();
	void shadowmap_end();
	void save_shadow_matrix();
	GLuint shadow_map;
	GLuint shadow_fbo;
	float shadow_map_size;
	double* shadow_matrix;
	
	// general light props
	bool  casting_shadow;
	float pos[3];
	int   prop_type;
	float prop_ambient[4];
	float prop_diffuse[4];
	float prop_specular[4];

	// spot props
	float prop_direction[4];
	float prop_exponent;
	float prop_cutoff;
};

#endif